package com.studymaster.domain;

import java.util.ArrayList;
import java.util.List;

public class DataFactory {

	public static List<Timeline> TIMELINE = getFakeTimeline();
	public static List<Timeline> getFakeTimeline(){
		List<Timeline> timelines = new ArrayList<Timeline>();
		
		Timeline timeline = new Timeline();
		timeline.id 		= 0;
		timeline.name		= "早餐";
		timeline.startTime	= 700;
		timelines.add(timeline);
		
		Timeline timeline1 = new Timeline();
		timeline1.id 		= 1;
		timeline1.name		= "第一节课";
		timeline1.startTime	= 800;
		timelines.add(timeline1);
		
		Timeline timeline2 = new Timeline();
		timeline2.id 		= 2;
		timeline2.name		= "第二节课";
		timeline2.startTime	= 1010;
		timelines.add(timeline2);
		
		Timeline timeline3 = new Timeline();
		timeline3.id 		= 3;
		timeline3.name		= "午餐";
		timeline3.startTime	= 1200;
		timelines.add(timeline3);
		
		Timeline timeline4 = new Timeline();
		timeline4.id 		= 4;
		timeline4.name		= "第三节课";
		timeline4.startTime	= 1400;
		timelines.add(timeline4);
		
		Timeline timeline5 = new Timeline();
		timeline5.id 		= 5;
		timeline5.name		= "第四节课";
		timeline5.startTime	= 1610;
		timelines.add(timeline5);
		
		Timeline timeline6 = new Timeline();
		timeline6.id 		= 6;
		timeline6.name		= "晚餐";
		timeline6.startTime	= 1800;
		timelines.add(timeline6);
		
		Timeline timeline7 = new Timeline();
		timeline7.id 		= 7;
		timeline7.name		= "欢乐时光";
		timeline7.startTime	= 1900;
		timelines.add(timeline7);
		
		return timelines;
	}
	
	public static Timeline getSuitableTimeline(int hour,int minute){
		Timeline suitableId = null;
		int eventtime = hour*100+minute;
		
		for(Timeline t:TIMELINE){
			if ( eventtime > t.startTime ) suitableId = t;
			if ( eventtime < t.startTime ) break;
		}
		
		return suitableId;
	}
	
	public static Timeline getTimelineById(int id){
		
		for(Timeline t:TIMELINE){
			if ( t.id == id ) return t;
		}
		
		return TIMELINE.get(0);
	}
	
	public static List<Event> getFakeEvent(){
		List<Event> events = new ArrayList<Event>();
		
		Event event = new Event();
		event.id 			= 0;
		event.name			= "形势政治";
		event.site			= "20212";
		event.theme			= Event.THEME_LEARNING;
		event.role			= "陈楷强";
		event.memo			= "要交论文";
		event.timeline		= 0;
		event.day			= Event.MONDAY;
//		event.startdate		= new Date(2013-1900, 3-1, 18);
		event.startdate		= "2013-03-18";
		events.add(event);
		
		Event event1 = new Event();
		event1.id 			= 1;
		event1.name			= "打球啊";
		event1.site			= "奥体中心";
		event1.theme		= Event.THEME_FUNNY;
		event1.role			= "陈楷强,田旭";
		event1.memo			= "要交论文";
		event1.timeline		= 1;
		event1.day			= Event.SUNDAY;
		event.startdate		= "2013-03-24";
//		event.startdate		= new Date(2013-1900, 3-1, 24);
		events.add(event1);
		
		Event event2 = new Event();
		event2.id 			= 2;
		event2.name			= "打球啊2";
		event2.site			= "奥体中心";
		event2.theme		= Event.THEME_FUNNY;
		event2.role			= "陈楷强,田旭";
		event2.memo			= "要交论文";
		event2.timeline		= 1;
		event2.day			= Event.SUNDAY;
		event.startdate		= "2013-03-24";
//		event.startdate		= new Date(2013-1900, 3-1, 24);
		events.add(event2);
		
		Event event3 = new Event();
		event3.id 			= 3;
		event3.name			= "吃饭";
		event3.site			= "工商腐败街";
		event3.theme		= Event.THEME_EATING;
		event3.role			= "陈楷强,田旭";
		event3.memo			= "要交论文";
		event3.timeline		= 7;
		event3.day			= Event.FRIDAY;
		event.startdate		= "2013-03-22";
//		event.startdate		= new Date(2013-1900, 3-1, 22);
		events.add(event3);
		
		Event event4 = new Event();
		event4.id 			= 4;
		event4.name			= "跳舞";
		event4.site			= "学生活动中心";
		event4.theme		= Event.THEME_FUNNY;
		event4.role			= "陈楷强,田旭";
		event4.memo			= "要交论文";
		event4.timeline		= 7;
		event4.day			= Event.FRIDAY;
		event.startdate		= "2013-03-22";
//		event.startdate		= new Date(2013-1900, 3-1, 22);
		events.add(event4);
		
		Event event5 = new Event();
		event5.id 			= 5;
		event5.name			= "你猜";
		event5.site			= "呵呵";
		event5.theme		= Event.THEME_FUNNY;
		event5.role			= "陈楷强,田旭";
		event5.memo			= "要交论文";
		event5.timeline		= 7;
		event5.day			= Event.FRIDAY;
		event.startdate		= "2013-03-22";
//		event.startdate		= new Date(2013-1900, 3-1, 22);
		events.add(event5);
		
		return events;
	}
	
}
